package common

import (
	"context"
	v1 "qiyu-contact/api/common/v1"
	"qiyu-contact/internal/service"
	"qiyu-contact/internal/utils"
)

type sCommon struct{}

func (s sCommon) Upload(ctx context.Context, req *v1.UploadReq) (res *v1.UploadRes, err error) {
	upload, err := utils.LocalUploadUtils.Upload(ctx, req.File)
	if err != nil {
		return nil, err
	}
	res = &v1.UploadRes{
		Url: upload,
	}
	return
}

func init() {
	service.RegisterCommon(&sCommon{})
}
